<%--
 *  File:    ControlGLAccount.jsp
 *  @Author: Langerwang
 *  Date:    2001/12/14
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>


<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  String strModuleName = "GL";
  String privilegeCode = "40108";
%>


<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/PageDefault.inc" %>

<%
  HashMap CurUserInfo = (HashMap)session.getAttribute("userinfo");
  if(CurUserInfo != null)
    CurUserInfo = new HashMap();
%>

<html>
<head>
<title>ControlGLAccountLeft</title>
<PageFlow:CheckPageFlow pageName="controlglaccountleft"/>
<%
  	Vector accounts = (Vector)pageContext.getAttribute("glaccounts");
  	if(accounts == null)
    	accounts = new Vector();
  	OvalTree initTree = new OvalTree(accounts,"glaccountclasscode","parentclasscode","grade");
  	initTree.setRecursiveLimit(2000);
  	Vector accountTree = (Vector)initTree.getTreeVector(new Integer(-1000),1);
%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../css/menu.js"></script>
<script language="JavaScript" src="../css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="../js/ScriptLib.js"></script>
<script language="JavaScript">
function page_view(id,code,grade,isbottom,parentcode)
{
  frm.glaccountclassid.value = id;
  frm.glaccountclasscode.value = code;
  frm.grade.value = grade;
  <%--[SCRIPT]  frm.isbottom.value = isbottom;    [SCRIPT]--%>
  frm.parentclasscode.value = parentcode;

  if(id == null || id.length == 0 || id == "")
    return;
  var link = "ControlGLAccountSummary.jsp?<%= OvalTools.randomURL() %>&glaccountlistid=<%=JspHelper.filterNull( request.getParameter("glaccountlistid") )%>&booksettype=<%=JspHelper.filterNull( request.getParameter("booksettype") )%>&booksetid=<%=JspHelper.filterNull( request.getParameter("booksetid") )%>";
  link = link + "&ispublic=1";
  if(grade == 2)
    link = link + "&classisbottom=Y";
  if(id != -1)
    link = link + "&glaccountclasscode=" + code + "&glaccountclassid=" + id;
  parent.rightFrame.location.href = link;
}
</script>
</head>

<body>
<form name="frm" method="post" action="">
  <input type="hidden" name="pagename" value="controlglaccountleft">
  <input type="hidden" name="actionname">

  <input type="hidden" name="glaccountclassid">
  <input type="hidden" name="glaccountclasscode">
  <input type="hidden" name="isbottom">
  <input type="hidden" name="grade">
  <input type="hidden" name="parentclasscode">

<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
  <tr>
    <td valign="top">
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td class="summary_top"></td>
        </tr>
      </table>
      <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center" height="98%">
		    <tr>
          <td colspan="-1" class="deepblue-left"><img src="../images/<%= strLanguageCode %>/quote.gif" width="16" height="11">
            <%= label.getLabelName("L_GLAccountClass") + label.getLabelName("L_Colon") %></td>
          </td>
        </tr>
        <tr>
          <td class="spe-td">
           <div id=div2 style="OVERFLOW: scroll; WIDTH: 100%; HEIGHT: 100%">

            <table cellspacing="0" width="100%">
             <tr>
              <td class="TreeClass1"><%if(accountTree.size() != 0){%><a href="javascript:expandIt(frm,'KB000','../images/<%= strLanguageCode %>/');"><%}%><img name="KB000wj" src="../images/<%= strLanguageCode %>/<%=JspHelper.filterNull( (accountTree.size() != 0)?"TreeAdd.gif":"TreeSub.gif" )%>" height="11" border="0" ><%if(accountTree.size() != 0){%></a><%}%><a href="javascript:page_view('-1','','0','T','-1000')"><%= label.getLabelName("L_All") %></a>
               <div class=child000 id=KB000Child>
               <%
                 int nTreeLevel = 0;
                 int nLevelDif = 0;
                 int nTopLevel = 0;
                 int nEndLevel = 0;
                 Integer nAccountOrgId = new Integer(-1);
                 String strIMG = "TreeAdd.gif";
                 for(int i = 0;i < accountTree.size();i++)
                 {
                   HashMap temp = (HashMap)accountTree.elementAt(i);
                   nAccountOrgId = (Integer)temp.get("orgid");
                   int nNext = ((Integer)temp.get("next")).intValue();
                   String strLevelCode = (String)temp.get("levelcode");
                   nTreeLevel = ((Integer)temp.get("grade")).intValue()+ nLevelDif;
                   if(((Boolean)temp.get("ismin")).booleanValue())
                     strIMG = "TreeSub.gif";
                   else
                     strIMG = "TreeAdd.gif";
                   for(int j = 0;j <= -nNext;j++){
                     if(i != 0){
               %>
                   </div></td></tr></table>
               <%    }
                   }
                   if(((Boolean)temp.get("ismax")).booleanValue())
                   {
                     nTreeLevel = 1;
                     nLevelDif = ((Integer)temp.get("grade")).intValue() - 1;
                   }
                   if(!((Boolean)temp.get("ismin")).booleanValue()){
               %>
                    <table cellspacing="0" width="100%">
                     <tr>
                      <td class="TreeClass<%=JspHelper.filterNull( nTreeLevel + 1 )%>"><a href="javascript:expandIt(frm,'KB<%=JspHelper.filterNull( strLevelCode )%>','../images/<%= strLanguageCode %>/'); "><img src="../images/<%= strLanguageCode %>/<%=JspHelper.filterNull( strIMG )%>" width="11" height="11" name="KB<%=JspHelper.filterNull( strLevelCode )%>wj" border="0"></a><a href="javascript:page_view('<%=JspHelper.filterNull( temp.get("glaccountclassid") )%>','<%=JspHelper.filterNull( temp.get("glaccountclasscode") )%>','<%=JspHelper.filterNull( temp.get("grade") )%>','<%=JspHelper.filterNull( temp.get("isbottom") )%>','<%=JspHelper.filterNull( temp.get("parentclasscode") )%>')"><%=JspHelper.filterNull( temp.get("glaccountclassname"))%></a>
                       <div class=child<%=JspHelper.filterNull( strLevelCode )%> id=KB<%=JspHelper.filterNull( strLevelCode )%>Child>
               <%  }
                   if(((Boolean)temp.get("ismin")).booleanValue()){
               %>
                    <table cellspacing="0" width="100%">
                     <tr>
                      <td class="TreeClass<%=JspHelper.filterNull( nTreeLevel + 1 )%>"><img src="../images/<%= strLanguageCode %>/<%=JspHelper.filterNull( strIMG )%>" width="11" height="11" name="KB<%=JspHelper.filterNull( strLevelCode )%>wj" border="0"><a href="javascript:page_view('<%=JspHelper.filterNull( temp.get("glaccountclassid") )%>','<%=JspHelper.filterNull( temp.get("glaccountclasscode") )%>','<%=JspHelper.filterNull( temp.get("grade") )%>','<%=JspHelper.filterNull( temp.get("isbottom") )%>','<%=JspHelper.filterNull( temp.get("parentclasscode") )%>')"><%=JspHelper.filterNull( temp.get("glaccountclassname"))%></a>
                       <div>
               <%
                   }
                   nEndLevel = ((Integer)temp.get("grade")).intValue();
                 }//end of vector loop
                 for(int h = 0; h <= nEndLevel - nTopLevel;h++){
               %>
                   </div></td></tr></table>
               <%}%>
           </div>
          </td>
        </tr>
        <tr>
          <td class="td-listrom">&nbsp;</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
  <input type="hidden" name="accountorgid" value="<%=JspHelper.filterNull( nAccountOrgId )%>">
</form>
<SCRIPT language=JavaScript1.2>initIt(frm,'../images/<%= strLanguageCode %>/');</SCRIPT>
</body>
</html>


